<?php 
require_once APPPATH.'controllers/app.php';
class Materials extends App {
    function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->library('grocery_CRUD');
    }
    function index(){
        $crud = new grocery_CRUD();
        $crud->set_subject('Nuyên liệu');
        $crud->set_table('tblmaterials');
        $crud->display_as('name','Tên nguyên liệu');
        $crud->display_as('unit','Đơn vị');
        $crud->display_as('cost','Chi phí');
        $crud->required_fields('name','unit','cost');
        $crud->set_rules('cost','Chi phí','numeric');
        $output = $crud->render();
        $output->title = "Nguyên liệu";
        $output->content_title = "Nguyên liệu";
        $output->sb = $this->_menu;
        $this->load->view('common/layout_view',$output);
   }
}
